package com.mes.service.impl;


import com.mes.entity.MesFactoryModel;
import com.mes.mapper.MesFactoryModelMapper;
import com.mes.service.MesFactoryModelService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @BelongsPackage: com.mes.service.impl
 * @Author: 源源瞬转
 * @CreateTime: 2024-10-10  08:44
 * @Description TODO:
 */
@Service
public class MesFactoryModelServiceImpl implements MesFactoryModelService {

    @Autowired
    private MesFactoryModelMapper mesFactoryModelMapper;
    @Override
    public Map ListByPageByLike(Integer pageNum, Integer pageSize, MesFactoryModel mesFactoryModel) {
        Map map = new HashMap();
        int offset = (pageNum-1)*pageSize;
        RowBounds rowBounds = new RowBounds(offset,pageSize);
        List<MesFactoryModel> list = mesFactoryModelMapper.ListByPageByLike(mesFactoryModel,rowBounds);
        List<MesFactoryModel> totalList = mesFactoryModelMapper.ListByPageByLike(mesFactoryModel);
        int total = totalList.size();
        map.put("list",list);
        map.put("total",total);
        return map;
    }
}
